package com.gzck.gzck_verson2.controller;


import com.gzck.gzck_verson2.pojo.GFwdUserprivilegeDetail;
import com.gzck.gzck_verson2.service.IGFwdUserprivilegeDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 用户权限详细表 前端控制器
 * </p>
 *
 * @author 任永辉
 * @since 2024-01-27
 */
@RestController
@RequestMapping("/g-fwd-userprivilege-detail")
public class GFwdUserprivilegeDetailController {

    @Autowired
    private IGFwdUserprivilegeDetailService userprivilegeDetailService;

    // 添加用户权限详细信息
    @PostMapping("/add")
    public boolean addUserprivilegeDetail(@RequestBody GFwdUserprivilegeDetail userprivilegeDetail) {
        return userprivilegeDetailService.save(userprivilegeDetail);
    }

    // 删除用户权限详细信息
    @DeleteMapping("/delete/{id}")
    public boolean deleteUserprivilegeDetail(@PathVariable Long id) {
        return userprivilegeDetailService.removeById(id);
    }

    // 更新用户权限详细信息
    @PutMapping("/update")
    public boolean updateUserprivilegeDetail(@RequestBody GFwdUserprivilegeDetail userprivilegeDetail) {
        return userprivilegeDetailService.updateById(userprivilegeDetail);
    }

    // 查询单个用户权限详细信息
    @GetMapping("/{id}")
    public GFwdUserprivilegeDetail getUserprivilegeDetail(@PathVariable Long id) {
        return userprivilegeDetailService.getById(id);
    }

    // 查询所有用户权限详细信息
    @GetMapping("/all")
    public List<GFwdUserprivilegeDetail> getAllUserprivilegeDetails() {
        return userprivilegeDetailService.list();
    }
}
